<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "t_discuss".
 *
 * @property int $id
 * @property string $content 内容
 * @property string $create_time 审核时间
 */
class Discuss extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 't_discuss';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['content'], 'string'],
            [['create_time'], 'safe'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'content' => Yii::t('app', '内容'),
            'create_time' => Yii::t('app', '审核时间'),
        ];
    }

    public function beforeSave($insert)
    {
        if(empty($this->create_time)){
            $this->create_time = date('Y-m-d H:i:s');
        }
        return parent::beforeSave($insert); // TODO: Change the autogenerated stub
    }
}
